<?php $this->load->view('admin_home/_header') ?>
<?php $this->load->view('message') ?>
<script tyep="text/javascript">
  $().ready(function(){
    $("#school_li").addClass("active"); 

    $('.selectpicker').selectpicker({ 
  });
    $("#school_add_form").validate({
        rules:{
            name:
            {
                required:true,
                maxlength:100,
                remote: {
                    url: "<?php echo site_url('admin_school/check_school_name_exist')?>",     //后台处理程序
                    type: "post",                //数据发送方式 
                    dataType: "json",          //接受数据格式  
                    data: {                     //要传递的数据
                        name: function() {
                            return $("#name").val();
                        }
                    }
                }
            },
        },
        messages:
        {
            name:
            {
                remote:"此学校名称已存在"
            }            
        }
    });   
  });
</script>

<div class="container">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">添加学校</h3>
        </div>
        <div class="panel-body">
            <?php echo validation_errors(); ?>
            <form id="school_add_form" method="post" class="form-horizontal"  enctype="multipart/form-data" action="<?php echo site_url('admin_school/add')?>" >
                <fieldset>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">学校名称:</label>
                        <div class="col-lg-8">
                            <input class="form-control" id="name" name="name"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-10 col-lg-offset-2">
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>

<?php $this->load->view('admin_home/_footer')?>